package com.isyscore.handler;

import com.isyscore.constant.ResponseCode;
import com.isyscore.util.ResultUtil;
import com.isyscore.vo.ResponseVo;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author: liuxq@isyscore.com
 * @Date: 2021-04-16 09:50:05
 * @Description: 暂无权限处理类
 */
@Component
public class UserAuthAccessDeniedHandler implements AccessDeniedHandler {
    /**
     * 暂无权限返回结果
     */
    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException exception) {
        ResultUtil.responseJson(response, ResponseVo.fail(ResponseCode.UN_AUTHORIZATION));
    }
}
